package com.es.system;

import java.sql.ResultSet;
import java.util.ArrayList;

import com.es.util.db.Dao;

public class ModifyPasswordBiz {

	public String updateLoginPassword(String newPassword, String username)
		/*      */     throws Exception
		/*      */   {
						Dao dao = new Dao();
						String result = "false";
						ArrayList<String> queryParm = new ArrayList<String>();
						queryParm.add(newPassword);
						queryParm.add(username);
						String sql = "update hrm_emp_info set emp_login_pwd=? where emp_login_id=?";
		/*      */     try {
						dao.update(sql, queryParm);
		/* 2534 */       result = "success";
		/*      */     } catch (Exception ex) {
		/* 2537 */       throw ex;
		/*      */     } finally {
						 dao.close();
		/*      */     }
		/* 2542 */     return result;
	}

	 public String getUserPassword(String userName)
	 throws Exception{
		 Dao dao = new Dao();
		 String password = "";
		 ArrayList<String> queryParm = new ArrayList<String>();
		 queryParm.add(userName);
		 try{
			 String sql = "select top 1 emp_login_pwd from hrm_emp_info where emp_login_id=? and del_flag='N' and  ltrim(rtrim(emp_login_yn)) ='Y'";
			 ResultSet rs = dao.Select(sql,queryParm);
			 if(rs.next()){
				 password = rs.getString("emp_login_pwd");
			 }
		 }catch(Exception ex){
			 throw ex;
		 }finally{
			 dao.close();
		 }
		 return password;
	 }
}
